home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™94 / Talks & Papers / Timothy Knox / Pixie Scheme Folder / Pixie Scheme / Debugger.s < prev    next >
Text File  |  1994-06-24  |  1KB  |  44 lines

  1. ;; Simple debugger for Pixie Scheme.  Not very useful.
  2.  
  3. ;     An environment list is a non–empty list whose last member
  4. ; is a vector, each of whose elements is in turn a list of symbols.
  5. ; All other members of the environment list are lists of symbols.
  6. ; The last member consists of all symbols that are bound at top–level.
  7. ; The first member consists of all symbols bound in the innermost
  8. ; lexical scope of the environment, the second member consists of all
  9. ; symbols bound in the next lexical scope, and so on.
  10.  
  11. (define (e::debug env-list) 
  12.   (newline) (newline)
  13.   (display "Run–Time Stack:") (newline)
  14.   (display "==============")  (newline)
  15.   (e::show-stack)
  16.   (display "Run–Time Stack (printed):") (newline)
  17.   (display "========================")  (newline)
  18.   (e::write-stack) (newline) (newline)
  19.   (display "Dynamic Environments:") (newline)
  20.   (display "====================")  (newline)
  21.   (e::show-envs env-list 0) (newline)
  22.   (e::reset))
  23.  
  24. (define (e::show-envs env-list n)
  25.   (if env-list
  26.     (begin
  27.       (if (not (vector? (car env-list)))
  28.         (e::show-env (car env-list) n))
  29.       (e::show-envs (cdr env-list) (+ n 1)))))
  30.  
  31. (define (e::show-env env n)
  32.   (display "-------- Environment ") (display n)
  33.   (display " of Environment List --------") (newline)
  34.   (e::show-env-1 env))
  35.   
  36. (define (e::show-env-1 env)
  37.   (if env
  38.     (begin
  39.       (display "  ") (e::show-symbol (car env)) (newline)
  40.       (e::show-env-1 (cdr env)))))
  41.  
  42. (define (e::show-symbol s)
  43.   (display s))
  44.